<template>
  <div class="block">
    <div class="info">
      <h4><img :src="icon" alt="" /> 公告信息</h4>
      <a href="javascript:;">更多>></a>
    </div>
    <ul>
      <li v-for="(item, i) in noticeinfo" :key="i">
        <p>{{ item.msgTitle }}：{{ item.msgContent }}</p>
        <span>
          {{ item.createDate }}
        </span>
      </li>
    </ul>
  </div>
</template>

<script>
import { infoList } from "@/service/message";
export default {
  name: "",
  data() {
    return {
      noticeinfo: null,
      icon: require("@/assets/images/control/info-icon.png"),
    };
  },
  created() {
    infoList(3, 0).then((res) => {
      if (res.data.items.length != 0) {
        this.noticeinfo = res.data.items;
      }
    });
  },
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.block {
  width: 100%;
  height: 100%;
  padding: 10px;
  * {
    margin: 0;
    padding: 0;
  }
  .info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 10%;
    width: 100%;
    h4 {
      display: flex;
      // justify-content: center;
      align-items: center;
      font-weight: normal;
      font-size: 15px;
      img {
        width: 20px;
        height: 20px;
        margin-right: 5px;
      }
    }
    a {
      font-size: 12px;
    }
  }
  ul {
    padding: 10px 20px;
    width: 100%;
    height: 90%;
    // background: lightcyan;
    list-style: none;
    overflow: hidden;

    li {
      width: 100%;
      height: 25%;
      border-top: 1px solid #e2e2e2;
      font-size: 13px;
      padding: 10px 0 0;
      &:last-of-type {
        border-bottom: 1px solid #e2e2e2;
      }
      p {
        word-wrap: normal; /* for IE */
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
        margin-bottom: 10px;
      }
      span {
        font-size: 12px;
        color: #999999;
        // margin-top: 10px;
      }
    }
  }
}
</style>